package com.my.structuraltype.mediator;

public class ConcreteMediator implements Mediator {
	
	//持有并维护同事A
	private ConcreteColleagueA a;
	//持有并维护同事B
	private ConcreteColleagueB b;
	
	/**
     * 某一个同事类发生了变化，通常需要与其他同事交互
     * 具体协调相应的同事对象来实现协作行为
     */
	@Override
	public void change(Colleague c) {
		if(c == a) {
			System.out.println("yeah, I know a has changed");
		} else if(c == b) {
			System.out.println("yeah, I know b has changed");
		}
	}
	

	/**
	 * @return the a
	 */
	public ConcreteColleagueA getA() {
		return a;
	}


	/**
	 * @param a the a to set
	 */
	public void setA(ConcreteColleagueA a) {
		this.a = a;
	}


	/**
	 * @return the b
	 */
	public ConcreteColleagueB getB() {
		return b;
	}


	/**
	 * @param b the b to set
	 */
	public void setB(ConcreteColleagueB b) {
		this.b = b;
	}

}
